using System;
using Gtk;

namespace doctruyewcf
{
	public partial class DetachedView : Gtk.Window
	{
		public DetachedView (Gdk.Pixbuf display, MainWindow main_f) : 
				base(Gtk.WindowType.Toplevel)
		{
			this.Build ();
			this.Fullscreen();
			this.KeyReleaseEvent += KeyReleaseHandler;
			cur_img = display;
			main_form = main_f;
		}

		public int cur_page;
		public Gdk.Pixbuf cur_img;
		public MainWindow main_form;

		protected void KeyReleaseHandler (object o, KeyReleaseEventArgs args)
		{
			Console.WriteLine ("Left arrow key pressed: " + args.Event.Key.ToString ());
			string key_pressed = args.Event.Key.ToString ();
			if (key_pressed == "Escape")
				Application.Quit ();
			if (key_pressed == "Left") {
				cur_page--;
				main_form.my_session.page_number--;
			}
			if (key_pressed == "Right") {
				cur_page++;
				main_form.my_session.page_number++;
			}
		}
	}
}

